package com.wangcang.widgetlibrary.activity;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;

import com.wangcang.widgetlibrary.R;
import com.wangcang.widgetlibrary.activity.base.BaseActivity;
import com.wangcang.widgetlibrary.bean.SwipeCardBean;
import com.wangcang.widgetlibrary.stacking.CardAdapter;
import com.wangcang.widgetlibrary.stacking.CardConfig;
import com.wangcang.widgetlibrary.stacking.OverLayCardLayoutManager;
import com.wangcang.widgetlibrary.stacking.TanTanCallback;

import java.util.List;

public class StackingActivity extends BaseActivity {
    RecyclerView mRecyclerView;
    List<SwipeCardBean> mDatas;
    CardAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_stacking);

        mRecyclerView = (RecyclerView) findViewById(R.id.recycleview);

        mRecyclerView.setLayoutManager(new OverLayCardLayoutManager());
        mAdapter = new CardAdapter(this, mDatas = SwipeCardBean.initDatas());
        mRecyclerView.setAdapter(mAdapter);

        CardConfig.initConfig(this);
        TanTanCallback callback = new TanTanCallback(mRecyclerView, mAdapter, mDatas);
        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(callback);
        itemTouchHelper.attachToRecyclerView(mRecyclerView);
    }
}
